import handleNum from './index'

const defaultState = {
  ...handleNum.state,
}

let reducer = (state = defaultState, action: { type: string }) => {
  let newState = JSON.parse(JSON.stringify(state))
  for (let key in handleNum.actionNames) {
    // 判断是不是相等
    if (handleNum.actionNames[key] === action.type) {
      handleNum.actions[action.type](newState, action)
      break
    }
  }
  return newState
}
export default reducer
